package com.zmj.sy.mom.srv.aps.controller;


import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.orderbom.OrderBomAppendReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.orderbom.OrderBomBatchAddReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.orderbom.OrderBomEditReqVo;
import com.zmj.sy.mom.srv.aps.service.OrderBomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RequiredArgsConstructor
@Api(tags = "BOM管理")
@RestController
@RequestMapping("/orderBom")
public class OrderBomController {

    private final OrderBomService orderBomService;

    @ApiOperation("bom编辑")
    @PostMapping("/edit")
    public BaseResVo edit(@RequestBody OrderBomEditReqVo reqVo){
        orderBomService.edit(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("批量添加")
    @PostMapping("/batchAdd")
    public BaseResVo batchAdd(@RequestBody List<OrderBomBatchAddReqVo> reqVo) {
//        System.out.println(JsonUtils.toJsonString(reqVo));
        orderBomService.batchAdd(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("追加订单")
    @PostMapping("/append")
    public BaseResVo append(@RequestBody OrderBomAppendReqVo reqVo) {
//        orderBomService.append(reqVo);
        return BaseResVo.ok();
    }


}
